package scau.cxq.homework;

import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;
import java.util.Iterator;

class ExecuteReducer extends Reducer<Text, NullWritable, Text, NullWritable> {

    @Override
    protected void reduce(Text key, Iterable<NullWritable> values, Context context)
            throws IOException, InterruptedException {

        Iterator<NullWritable> iterator = values.iterator();

        if (iterator.hasNext()) {
            context.write(key, iterator.next());
        }
    }
}